{% extends "user/common.html" %}

{% block title %}用户收藏{% endblock %}

{% block head %}
    <link rel="stylesheet" type="text/css" href="{{ url_for("static", filename="css/user/collect.css") }}">
{% endblock %}
{% block body %}
    <header>
        <h1>收藏管理</h1>
    </header>
    <table>
        <thead>
        <tr>
            <th>序号</th>
            <th>书名</th>
            <th>作者</th>
            <th>简介</th>
            <th>库存</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for book in data.book_list %}
            <tr>
                <td>{{ loop.index }}</td>
                <td>{{ data.book_list[loop.index].book_name }}</td>
                <td>{{ data.book_list[loop.index].author }}</td>
                <td>{{ data.book_list[loop.index].text }}</td>
                <td>{{ data.book_list[loop.index].current_number }}/{{ data.book_list[loop.index].number }}</td>
                <td>
                    <button onclick="window.location.href='{{ url_for('blueprint.collect', id=data.book_list[loop.index].book_id) }}'">取消收藏</button>
                    <button onclick="window.location.href='{{ url_for('blueprint.borrow', id=data.book_list[loop.index].book_id) }}'">借阅</button>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

{% endblock %}